<!--
 * @Description: 
 * @Author: huxianc
 * @Date: 2020-11-12 08:53:33
 * @LastEditors: huxianc
 * @LastEditTime: 2020-11-12 09:20:04
-->

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>cookie简化</title>
    <style>
      * {
        box-sizing: border-box;
      }
      body,
      html {
        margin: 0;
        padding: 0;
      }
      .container {
        width: 100%;
        height: 100vh;
        /* display: flex;
        justify-content: center; */
        text-align: center;
        padding-top: 100px;
      }
      button {
        color: #fff;
        display: inline-block;
        padding: 12px 20px;
        outline: none;
        border: 1px solid #409eff;
        border-radius: 4px;
        background-color: #409eff;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        text-align: center;
        vertical-align:text-bottom;
        font-weight: 500;
        font-size: 14px;
        transition: 0.1s;
      }
      button:hover {
        background-color: #66b1ff;
        border-color: #66b1ff;
      }
      textarea {
        display: inline-block;
        margin: 0 10px;
        padding: 5px 15px;
        line-height: 1.5;
        color: #606266;
        background-image: none;
        border-radius: 4px;
        font-size: 14px;
        border: 1px solid #dcdfe6;
        transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
      }
      textarea:hover {
        border-color: #c0c4cc;
      }
      textarea:focus {
        outline: none;
        border-color: #409eff;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <textarea id="input" rows="20" cols="50" placeholder="请输入您的cookie ..."></textarea>
      <button onClick="simple()">简化</button>
      <textarea id="simpleValue" rows="5" cols="50" placeholder="点击简化即可获得噢"></textarea>
    </div>

    <script>
      function simple() {
        const value = document.querySelector("#input").value.trim();
        if (value.length === 0) return;
        const cookie = value.match(/pt_pin=.+?;/) + value.match(/pt_key=.+?;/);
        document.querySelector("#simpleValue").value = cookie;
      }
    </script>
  </body>
</html>
